﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CommonExtensions.ObjectExtensions;

namespace DBMigrator.Core.DbObjects.Data.Insert
{
    public class InsertIntoValues<T> : IInsertIntoValues<T>
    {
        public IEnumerable<object> Values { get; private set; }

        public void Value(T value)
        {
            if(value.IsNull())
                throw new ArgumentNullException("value");

            Values = new List<object> { value };
        }

        void IInsertIntoValues<T>.Values(IEnumerable<T> values)
        {
            if(values.IsNull())
                throw new ArgumentNullException("values");
            if(values.Count() == 0)
                throw new ArgumentException("values collection cannot be empty", "values");

            Values = values.Cast<object>();
        }
    }
}
